package com.dubbo.sbdprovider;

import com.alibaba.dubbo.config.annotation.Service;
import com.dubbo.sbdinterface.CommonService;
import com.dubbo.sbdprovider.jdbcutil.JdbcUtil;
import org.springframework.stereotype.Component;
import reactor.core.publisher.Mono;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;

/**
 *
 * @author Arat.Wu
 * @date 2019/01/22
 */
@Component//加入容器组件
@Service(timeout = 10000)//暴露服务
public class CommonServiceImpl implements CommonService {
    @Override
    public List<HashMap> getList(String sql) throws SQLException, ClassNotFoundException {
        System.out.println("+++++++++");
        final List<HashMap> hashMaps = JdbcUtil.queryList(sql);
        return hashMaps;
    }

    @Override
    public Mono<String> getList2() {
        return Mono.just("welcome to getList");
    }
}
